package MovieGuessingGame.login;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JPasswordField;


public class LoginJPanel extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 8743903550029444122L;
	JTextField userNameField;
	
	public String getUserName() {
		return userNameField.getText();
	}
	JPasswordField passwordField;
	JButton btnNewButton;
	JButton btnStartButton;
	JTextField messageField;
	JComboBox<String> playerBox;

	public String getMessageFieldText() {
		return messageField.getText();
	}
	public void setMessageFieldText(String text) {
		this.messageField.setText(text);
		messageField.updateUI();
		this.repaint();
		this.setVisible(true);
		System.out.println("setMessageFieldText" + text);
	}
	
	public void setStartButtonText(String text) {
		this.btnStartButton.setText(text);
		btnStartButton.updateUI();
		this.repaint();
		this.setVisible(true);
		System.out.println("setStartButtonText" + text);
	}
	/**
	 * Create the panel.
	 */
	public LoginJPanel() {
		setLayout(null);
		
		JLabel lblNewLabel = new JLabel("User Name");
		lblNewLabel.setBounds(64, 55, 84, 16);
		add(lblNewLabel);
		
		JLabel lblNewLabel_1 = new JLabel("Password");
		lblNewLabel_1.setBounds(64, 88, 84, 16);
		add(lblNewLabel_1);
		
		btnNewButton = new JButton("Login");
		btnNewButton.setBounds(179, 118, 97, 25);
		add(btnNewButton);

		userNameField = new JTextField();
		userNameField.setBounds(158, 52, 175, 22);
		add(userNameField);
		userNameField.setColumns(10);
		
		messageField = new JTextField();
		messageField.setBounds(158, 154, 175, 22);
		add(messageField);
		messageField.setColumns(10);
		
		passwordField = new JPasswordField();
		passwordField.setBounds(158, 85, 175, 22);
		add(passwordField);
		
		JLabel lblPleaseLogin = new JLabel("Please Login");
		lblPleaseLogin.setBounds(179, 11, 105, 16);
		add(lblPleaseLogin);
		
		playerBox = new JComboBox<String>();
		playerBox.setEnabled(true);
		playerBox.setEditable(true);
		playerBox.setBounds(64, 217, 188, 20);
		add(playerBox);
		
		btnStartButton = new JButton("Start Game");
		btnStartButton.setEnabled(false);

		btnStartButton.setBounds(262, 216, 120, 23);
		add(btnStartButton);

	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		LoginJPanel login = new LoginJPanel();
		JFrame frame = new JFrame();
		frame.getContentPane().add(login);

		frame.setSize(500, 400);
		login.setVisible(true);
		frame.setVisible(true);
	}
}
